New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poisson naive Bayes classifier (PoissonNB) #3708
Conversation
X = check_array(X) | ||
|
||
joint_log_likelihood = [] | ||
for i in range(np.size(self.classes_)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np.size(self.classes_) -> len(self.classes_)
looks clean you'll need to add proper tests and some narrative doc to explain for what type of data this model is useful. |
By narrative doc, do you mean expand the class docstring or somewhere else? |
Narrative as distinct from docstrings, examples and tutorials: stuff in On 27 September 2014 23:36, BrianLondon notifications@github.com wrote:
|
>>> clf.fit(X, y) | ||
PoissonNB() | ||
>>> print(clf.predict(X)) | ||
[1 1 1 2 2 2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add here a reference paper which includes the derivation?
@@ -0,0 +1,91 @@ | |||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this file here?
same for out.txt
looks like something went wrong in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I checked in four working files by mistake, then only pulled two back out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'll need to squash commits to remove these files from history
Poisson classifiers have important applications in systems neuroscience. See: Ma et Al. Nat. Neuroscience 9:1432 (2006). Added some tests specifically for the PoissonNB class. Implemented some of the TODOs in test_naive_bayes.py while I was in there. Added documentation of PoissonNB to naive_bayes.rst and some details to the docstring in naive_bayes.py. Adding documentation for PoissonNB class.
Added previous round (including PEP8) fixes and rebased. |
for i in range(np.size(self.classes_)): | ||
|
||
joint_log_likelihood = np.zeros((np.shape(X)[0], | ||
np.size(self.classes_))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np.size -> len
Closing stale PR. I'll reopen if I get time to work on this again. |
Added PoissonNB class to naive_bayes.py to implement a Poisson naieve Bayes classifier. Poisson classifiers have important applications in systems neuroscience. See: Ma et Al. Bayesian inference with probabilistic population codes Nat. Neuroscience 9:1432 (2006).